home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 20 Feb 2002
- //
- // Description:
- // Make sure the fluid's resolution matches its cache
- //
- //
- global proc fluidCheckResolutionAgainstCaches() {
- if( !`exists getActiveFluidsShapes` ) {
- source "getFluidShape.mel";
- }
-
- string $activeFluids[] = getActiveFluidShapes();
- for( $fluid in $activeFluids ) {
- float $fRes[] = `getAttr ($fluid + ".resolution")`;
- int $errorCondition = 0;
-
- int $hasCache = `fluidCacheInfo -hasCache -ic $fluid`;
-
- if( $hasCache == 1 ) {
- int $icRes[] = `fluidCacheInfo -ic -re $fluid`;
- if( $icRes[0] != $fRes[0]
- || $icRes[1] != $fRes[1]
- || $icRes[2] != $fRes[2] )
- {
- $errorCondition += 1;
- }
- }
-
- $hasCache = `fluidCacheInfo -hasCache -pb $fluid`;
-
- if( $hasCache == 1 ) {
- int $pbRes[] = `fluidCacheInfo -pb -re $fluid`;
- if( $pbRes[0] != $fRes[0]
- || $pbRes[1] != $fRes[1]
- || $pbRes[2] != $fRes[2] )
- {
- $errorCondition += 2;
- }
- }
-
- string $noMatch = ( "The resolution of \'" + $fluid + "\' does not " +
- "match the resolution of its " );
-
- string $rebuild;
- string $rebuildPB = "To rebuild the cache, use \'Create Cache\'. ";
- string $rebuildIC = ( "To rebuild the Initial State, use \'Set as " +
- "Initial State\'. " );
- string $changeRes = ( "To change a fluid's resolution, use \'Edit Fluid " +
- "Resolution\'." );
-
- if( $errorCondition > 2 ) {
- $noMatch += "cache or Initial State. ";
- $rebuild = $rebuildPB + $rebuildIC;
- } else if( $errorCondition > 1 ) {
- $noMatch += "cache. ";
- $rebuild = $rebuildPB;
- } else if( $errorCondition > 0 ) {
- $noMatch += "Initial State. ";
- $rebuild = $rebuildIC;
- }
-
- if( $errorCondition > 0 ) {
- warning( $noMatch );
- warning( $rebuild );
- warning( $changeRes );
- }
- }
- }
-
-